Skip to content

feat(clerk-js): Support open userProfile and organizationProfile modals to specific navitems - #3732

Merged
EmmanouelaPothitou merged 14 commits into
mainfrom
emmanouela/user-176-support-open-openuserprofile-to-specific-page
Jul 25, 2024
Merged

feat(clerk-js): Support open userProfile and organizationProfile modals to specific navitems#3732
EmmanouelaPothitou merged 14 commits into
mainfrom
emmanouela/user-176-support-open-openuserprofile-to-specific-page

Conversation

@EmmanouelaPothitou

@EmmanouelaPothitou EmmanouelaPothitou commented Jul 16, 2024

Copy link
Copy Markdown
Contributor

Description

Support opening the userProfileModal and organizationProfileModal to specific navigation items through the userButton and organizationSwitcher.

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@changeset-bot

changeset-bot Bot commented Jul 16, 2024

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e92ffe0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
Name Type
@clerk/clerk-js Patch
@clerk/types Patch
@clerk/astro Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch
@clerk/backend Patch
@clerk/elements Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/localizations Patch
@clerk/nextjs Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch
@clerk/shared Patch
@clerk/tanstack-start Patch
@clerk/testing Patch
@clerk/themes Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment thread packages/clerk-js/src/ui/hooks/useNavigateToFlowStart.ts Outdated
@EmmanouelaPothitou
EmmanouelaPothitou force-pushed the emmanouela/user-176-support-open-openuserprofile-to-specific-page branch from e5a8015 to 5953bb2 Compare July 17, 2024 10:11
@EmmanouelaPothitou EmmanouelaPothitou changed the title Emmanouela/user 176 support open openuserprofile to specific page feat(clerk-js): support open userProfile and organizationProfile modals to specific nav items Jul 17, 2024
@EmmanouelaPothitou EmmanouelaPothitou changed the title feat(clerk-js): support open userProfile and organizationProfile modals to specific nav items feat(clerk-js):support-open-userProfile-and-organizationProfile-modals-to-specific-navitems Jul 17, 2024
@EmmanouelaPothitou EmmanouelaPothitou changed the title feat(clerk-js):support-open-userProfile-and-organizationProfile-modals-to-specific-navitems feat(clerk-js): Support open userProfile and organizationProfile modals to specific navitems Jul 17, 2024
@EmmanouelaPothitou
EmmanouelaPothitou marked this pull request as ready for review July 17, 2024 12:51
Comment thread packages/clerk-js/src/ui/components/UserButton/useMultisessionActions.tsx Outdated
Comment thread packages/clerk-js/src/ui/elements/Navbar.tsx Outdated
const router = useRouter();
const navigateToFlowStart = async () => {
const to = '/' + router.basePath + router.flowStartPath;
const to = router.indexPath;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you briefly, our discoveries and why this is a "safe" change ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the current modal setup, the first element is associated with the '/' path. Previously, clicking the back button in the modal's sidebar navigation would navigate back to the path constructed by '/' + router.basePath + router.flowStartPath, since the modal always opened with the first element selected.

Now, with the ability to open the modal on a specific element, the router.flowStartPath is not necessarily the path for the first element anymore. That's why we should now navigate to router.indexPath instead of the previously used router.flowStartPath.

@anagstef

Copy link
Copy Markdown
Contributor

@EmmanouelaPothitou can we have an example code snippet of how this will be used by the users?

@EmmanouelaPothitou

Copy link
Copy Markdown
Contributor Author

have an example code snippet

@anagstef This function will not be used directly by the user. Instead, it will be utilized by custom menu items, which will be introduced in another PR that Nikos will open in the next days. Therefore, I do not have an example code snippet at this time.

Comment thread packages/clerk-js/src/ui/Components.tsx Outdated
Comment thread packages/clerk-js/src/ui/Components.tsx Outdated
}
openUserProfile({
...opts.userProfileProps,
...(__experimental_startPath && { __experimental_startPath }),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓Shouldn't we update the types of UserProfileModalProps and OrgProfileModalProps to include __experimental_startPath ?

EmmanouelaPothitou and others added 4 commits July 24, 2024 14:46
…izationSwitcherPopover.tsx

Co-authored-by: panteliselef <panteliselef@outlook.com>
Co-authored-by: panteliselef <panteliselef@outlook.com>
Co-authored-by: panteliselef <panteliselef@outlook.com>
@EmmanouelaPothitou
EmmanouelaPothitou force-pushed the emmanouela/user-176-support-open-openuserprofile-to-specific-page branch from f3b0b4c to a642fce Compare July 24, 2024 14:22
Comment thread .changeset/cuddly-spoons-decide.md
void preloadComponent(preloadHint);
}
componentsControlsResolver = import('./lazyModules/common').then(({ createRoot }) => {
createRoot(clerkRoot!).render(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this changed by mistake from the linter or it's a conscious change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linter changed it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should revert it then

Comment thread packages/clerk-js/src/ui/Components.tsx Outdated
@octoper

octoper commented Jul 25, 2024

Copy link
Copy Markdown
Contributor

!preview

@clerk-cookie

clerk-cookie commented Jul 25, 2024

Copy link
Copy Markdown
Collaborator

Hey @octoper, your preview is available.

Status Preview Updated (UTC)
🍪 Deployed Visit preview Jul 25, 2024 11:44 AM

@octoper octoper left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 Good job @EmmanouelaPothitou!

@anagstef anagstef left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

Comment thread .changeset/cuddly-spoons-decide.md Outdated
EmmanouelaPothitou and others added 2 commits July 25, 2024 14:57
Co-authored-by: Vaggelis Yfantis <me@octoper.me>
Co-authored-by: Stefanos Anagnostou <anagstef@users.noreply.github.com>
@EmmanouelaPothitou
EmmanouelaPothitou merged commit b486897 into main Jul 25, 2024
@EmmanouelaPothitou
EmmanouelaPothitou deleted the emmanouela/user-176-support-open-openuserprofile-to-specific-page branch July 25, 2024 12:21
brkalow pushed a commit that referenced this pull request Aug 1, 2024
…ls to specific navitems (#3732)

Co-authored-by: panteliselef <panteliselef@outlook.com>
Co-authored-by: Vaggelis Yfantis <me@octoper.me>
Co-authored-by: Stefanos Anagnostou <anagstef@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants